<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2016/3/29
  Time: 14:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/WEB-INF/view/common/jsp_top.jsp" %>

<script type="text/javascript">
    //1、数据初始化
    j(document).ready(function(){
        //1.1、请求数据
        j("#treegrid").treegrid({
            border:false,
            url:'menu/load',
            method:'post',
            striped:true,
            rownumbers:true,
            singleSelect:true,
            idField:'id',
            treeField:'name',
            frozenColumns:[[
                {field:'name',title:'菜单',width:300}
            ]],
            columns:[[
                {field:'id',title:'主键',width:80,hidden:true},
                {field:'path',title:'路径',width:380},
                {field:'permission',title:'权限',width:150},
                {field:'sortNo',title:'排序号',width:50},
                {field:'isShow',title:'是否显示',width:60,align:'center'},
                {field:'opt',title:'操作',width:80,align:'center',
                    formatter: function(value,rowData,rowIndex){
                        var e = "<a href=\"javascript:void(0)\" onclick=\"_editPage(\'" + rowData.id + "\')\">修改</a>&nbsp; ";
                        var d = "<a href=\"javascript:void(0)\" onclick=\"_delete(\'" + rowData.id + "\')\">删除</a>&nbsp; ";
                        return e + d;
                    }
                }
            ]],
            onClickRow:function(node){
                var isLeaf=j(this).tree('isLeaf',node.target);
                if(!isLeaf){//非叶节点
                    j(this).tree('toggle',node.target);
                }
            },
            toolbar:[
                 {text : '新增',iconCls : 'icon-add',handler : function() {_addPage("addPage","菜单","menu/addPage","treegrid");}}, '-',
                {text : '刷新',iconCls : 'icon-reload',handler : function() {_treeRefresh("treegrid");}}, '-',
                {text : '折叠',iconCls : 'icon-undo',handler : function() {_collapse("treegrid");}}, '-',
                {text : '展开',iconCls : 'icon-redo',handler : function() {_expand("treegrid");}}
            ],
            pagination:false
        });

    });

</script>
<!-- 数据列表 -->
<table id="treegrid"  > </table>
<%@include file="/WEB-INF/view/common/jsp_bottom.jsp" %>